<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 过滤标签 -->
    <script>
        var arr = "<p>dhauwidgwueah </p><p> <div></div>";

        /*这里加号是表面[]里面包含多个字符。
        例如，<dabcd>,<idd>,<voop>等都会被查找到*/
        var reg = /<[^div]+>/g; 
        console.log(arr.replace(reg,""));
        console.log(arr.match(reg));
    </script>

    <!--  只获取数字 -->
    <script>
        var str = "https://www.baidu.com/subject/12323e/dnf212";
        // 第一种
        var a = /\d+/g;
        console.log(str.search(a));
        // 第二种
        var b = /[^\d]+/g;
        console.log(str.replace(b,""));
    </script>

    <!--  -->
</body>
</html>